package com.ayitubie.refuelweb.config.jedis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import redis.clients.jedis.JedisCluster;

@Service
public class JedisService {

    @Autowired
    private JedisCluster jedisCluster;

    public void set(String key, String value) {
        jedisCluster.set(key, value);
    }

    public String get(String key) {
        return jedisCluster.get(key);
    }

    public void setEx(String key, String value, int seconds) {
        jedisCluster.setex(key, seconds, value);
    }

    public Long setNx(String key, String value) {
        return jedisCluster.setnx(key, value);
    }

    public Long del(String key) {
        return jedisCluster.del(key);
    }

    public Boolean exists(String key) {
        return jedisCluster.exists(key);
    }

    public Long expire(String key,long seconds) {
        return jedisCluster.expire(key,seconds);
    }

    public Long ttl(String key) {
        return jedisCluster.ttl(key);
    }

}